package com.ruiysoft.website.service;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.ruiysoft.website.entity.CmsMenu;
import com.ruiysoft.website.mapper.CmsMenuMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by liudh on 2019/4/25.
 */

@Service
public class CmsMenuService {
    @Autowired
    CmsMenuMapper cmsMenuMapper;

    public List<CmsMenu> selectList(String enterpriseId, String parentCode) {
        EntityWrapper ew = new EntityWrapper();
        ew.eq("enterpriseId", enterpriseId)
                .eq("parentCode", parentCode);

        return JSON.parseObject(JSON.toJSONString(cmsMenuMapper.selectList(ew)), new TypeReference<List<CmsMenu>>(){});
    }
}
